<div class="col-md-12" style="width: 100%;height: auto;background-color: #fff;padding: 15px;margin-bottom: 15px;">
    <div class="row">
        <div class="col-md-8 ">
            <img class="profile-user-img img-responsive img-circle" style="margin: 0; float: left" src="{% if app.user.avatar is not null %}{{ app.user.avatar }}{% else %}{{ asset('images/sf-positive.svg') }}{% endif %}">
            <span style="display: inline-block; float: left; line-height: 100px; margin-left: 20px; font-size: 20px;">{{ app.user.getGreeting }}</span>
        </div>
        <div class="col-md-4" style="margin-top: 22px;">
            <div class="head-info">
                <span>浏览量</span>
                <p>{{ page_view_total|number_format(0, '.', ',') }}</p>
            </div>
            <div class="head-info split-right">
                <span>评论数</span>
                <p>{{ page_comment_total|number_format(0, '.', ',') }}</p>
            </div>
            <div class="head-info split-right">
                <span>文章数</span>
                <p>{{ page_total|number_format(0, '.', ',') }}</p>
            </div>
        </div>
    </div>
</div>
<div class="col-md-12">
    <div class="row">
        <div class="col-md-8" style="padding-left: 0px;">
            <div class="box box-default">
                <div class="box-header with-border">
                    <h3 class="box-title">热门博文</h3>
                    <div class="box-tools pull-right">
                        <button type="button" class="btn btn-box-tool" data-widget="collapse"><i
                                    class="fa fa-minus"></i></button>
                    </div>
                </div>
                <div class="box-body no-padding">
                    {% if page_hots|length > 0 %}
                        <ul class="users-list clearfix">
                            {% for key,page in page_hots %}
                                <li {% if (key + 1) % 3 == 0 %}style="border-right: none" {% endif %}>
                                    <div style="text-align: left">
                                        <img src="{% if page.avatar is not null %}{{ page.avatar }}{% else %}{{ asset('images/sf-positive.svg') }}{% endif %}" class="user-image" style="width: 30px;height: 30px">
                                        <span class="hidden-xs" style="padding-left: 10px;">{{ page.username }}</span>
                                    </div>
                                    <a class="page-title" href="/admin/page/{{ page.id }}/edit">{{ page.title }}</a>
                                    <span class="item-1">{{ page.category }}</span>
                                    <span class="item-2">{{ page.page_view|number_format(0, '.', ',') }}</span>
                                </li>
                            {% endfor %}
                        </ul>
                    {% endif %}
                </div>
                <div class="box-footer text-center" style="border-top: none">
                    <a href="{{ path('admin_page_list') }}" class="uppercase">查看更多</a>
                </div>
            </div>

            <div class="box box-default">
                <div class="box-header with-border">
                    <h3 class="box-title">最新留言</h3>
                    <div class="box-tools pull-right">
                        <button type="button" class="btn btn-box-tool" data-widget="collapse"><i class="fa fa-minus"></i></button>
                    </div>
                </div>
                <div class="box-body">
                    {% if feedback|length > 0 %}
                        <ul class="products-list product-list-in-box">
                            {% for item in feedback %}
                                <li class="item">
                                    <div class="product-info">
                                        <a href="/admin/feedback/{{ item.id }}/show" class="product-title">{{ item.nickname }}</a>
                                        <span class="label pull-right" style="color: #999; font-weight: normal" title="{{ item.createdAt|date('Y-m-d H:i:s', 'PRC') }}">{{ item.createdAt|ago }}</span>
                                        <span class="product-description" style="margin-top: 7px" title="{{ item.content }}">{{ item.content }}</span>
                                    </div>
                                </li>
                            {% endfor %}
                        </ul>
                    {% endif %}
                </div>
                <div class="box-footer text-center">
                    <a href="{{ path('admin_feedback_list') }}" class="uppercase">查看更多</a>
                </div>
            </div>
        </div>
        <div class="col-md-4" style="padding-right: 0px;">
            <div class="box box-default">
                <div class="box-header with-border">
                    <h3 class="box-title">快捷方式</h3>
                    <div class="box-tools pull-right">
                        <button type="button" class="btn btn-box-tool" data-widget="collapse">
                            <i class="fa fa-minus"></i>
                        </button>
                    </div>
                </div>
                <div class="box-body">
                    <ul class="clearfix shortcut">
                        <li>
                            <a href="{{ path('admin_page_create') }}">发布博文</a>
                        </li>
                        <li>
                            <a href="/admin/page_comment/list?filter%5Bpage_id%5D%5Btype%5D=&filter%5Bpage_id%5D%5Bvalue%5D=&filter%5Bstatus%5D%5Btype%5D=&filter%5Bstatus%5D%5Bvalue%5D=0&filter%5Bcreated_at%5D%5Btype%5D=&filter%5Bcreated_at%5D%5Bvalue%5D=&filter%5B_page%5D=1&filter%5B_sort_by%5D=id&filter%5B_sort_order%5D=DESC&filter%5B_per_page%5D=32">评论审核</a>
                        </li>
                        <li>
                            <a href="{{ path('admin_feedback_list') }}">留言查看</a>
                        </li>
                        <li>
                            <a href="{{ path('admin_menu_list') }}">菜单管理</a>
                        </li>
                        <li>
                            <a href="{{ path('admin_gallery_list') }}">图集管理</a>
                        </li>
                        <li>
                            <a href="{{ path('admin_blogroll_create') }}">添加友链</a>
                        </li>
                        <li>
                            <a href="{{ path('admin_log_list') }}">日志查看</a>
                        </li>
                    </ul>
                </div>
            </div>

            <div class="box box-default">
                <div class="box-header with-border">
                    <h3 class="box-title">类别占比</h3>
                    <div class="box-tools pull-right">
                        <button type="button" class="btn btn-box-tool" data-widget="collapse"><i class="fa fa-minus"></i></button>
                    </div>
                </div>
                <div class="box-body">
                    <div class="row">
                        <div class="col-md-8">
                            <div class="chart-responsive">
                                <canvas id="pieChart" height="155"></canvas>
                            </div>
                        </div>
                        <div class="col-md-4">
                            <ul class="chart-legend clearfix">
                                {% for key,item in page_category_scale %}
                                    <li><i class="fa fa-circle-o" style="color: {{ attribute(page_category_scale_colors, key) }}"></i> {{ item.value }}</li>
                                {% endfor %}
                            </ul>
                        </div>
                    </div>
                </div>
                <div class="box-footer no-padding">
                    <ul class="nav nav-pills nav-stacked">
                        {% for key,item in page_category_scale %}
                            {% if key < 3 %}
                                <li>
                                    <a href="/admin/page/list?filter[page_category_id][type]=&filter[page_category_id][value]={{ item.id }}">
                                        {{ item.value }}<span class="pull-right" style="color: #999"></i> {{ item.num }}</span>
                                    </a>
                                </li>
                            {% endif %}
                        {% endfor %}

                    </ul>
                </div>
                <script>
                    let pieChartCanvas = $("#pieChart").get(0).getContext("2d");
                    let pieChart = new Chart(pieChartCanvas);
                    let PieData = [
                        {% for key,item in page_category_scale %}
                            {
                                value: {{ item.num }},
                                color: "{{ attribute(page_category_scale_colors, key) }}",
                                highlight: "{{ attribute(page_category_scale_colors, key) }}",
                                label: "{{ item.value }}"
                            },
                        {% endfor %}
                    ];
                    let pieOptions = {
                        //Boolean - Whether we should show a stroke on each segment
                        segmentShowStroke: true,
                        //String - The colour of each segment stroke
                        segmentStrokeColor: "#fff",
                        //Number - The width of each segment stroke
                        segmentStrokeWidth: 1,
                        //Number - The percentage of the chart that we cut out of the middle
                        percentageInnerCutout: 50, // This is 0 for Pie charts
                        //Number - Amount of animation steps
                        animationSteps: 100,
                        //String - Animation easing effect
                        animationEasing: "easeOutBounce",
                        //Boolean - Whether we animate the rotation of the Doughnut
                        animateRotate: true,
                        //Boolean - Whether we animate scaling the Doughnut from the centre
                        animateScale: false,
                        //Boolean - whether to make the chart responsive to window resizing
                        responsive: true,
                        // Boolean - whether to maintain the starting aspect ratio or not when responsive, if set to false, will take up entire container
                        maintainAspectRatio: false,
                        //String - A tooltip template
                        tooltipTemplate: "<%=label%> - <%=value %> 文章"
                    };
                    pieChart.Doughnut(PieData, pieOptions);
                </script>
            </div>

            <div class="box box-default">
                <div class="box-header with-border">
                    <h3 class="box-title">最新评论</h3>
                    <div class="box-tools pull-right">
                        <button type="button" class="btn btn-box-tool" data-widget="collapse"><i class="fa fa-minus"></i></button>
                    </div>
                </div>
                <div class="box-body">
                    {% if page_comment|length > 0 %}
                        <ul class="products-list product-list-in-box">
                            {% for comment in page_comment %}
                                <li class="item">
                                    <div class="product-info">
                                        <a href="/admin/page_comment/{{ comment.id }}/show" class="product-title">{{ comment.nickname }}</a>
                                        <span class="label pull-right" style="color: #999; font-weight: normal" title="{{ comment.createdAt|date('Y-m-d H:i:s', 'PRC') }}">{{ comment.createdAt|ago }}</span>
                                        <span class="product-description" style="margin-top: 7px" title="{{ comment.comment }}">{{ comment.comment }}</span>
                                    </div>
                                </li>
                            {% endfor %}
                        </ul>
                    {% endif %}
                </div>
                <div class="box-footer text-center">
                    <a href="{{ path('admin_page_comment_list') }}" class="uppercase">查看更多</a>
                </div>
            </div>
        </div>
    </div>
</div>